local status, mason = pcall(require, "mason")
if not status then
  vim.notify("Not found mason")
  return
end

local mason_registry = require("mason-registry")
local mason_list = require("plugin.plugins.mason.list_plugins")

mason.setup({
  ui = {
    icons = {
      package_installed = "✓",
      package_pending = "➜",
      package_uninstalled = "✗",
    },
  },
})

local ensure_installed = function()
  for _, name in pairs(mason_list) do
    if not mason_registry.is_installed(name) then
      local package = mason_registry.get_package(name)
      package:install()
    end
  end
end

mason_registry.refresh(vim.schedule_wrap(ensure_installed))


local lsp_status, mason_lspconfig = pcall(require, "mason-lspconfig")
if not lsp_status then
  vim.notify("Not found mason-lspconfig")
  return
end

-- lsp servers manager
local lsp_servers = require("plugin.plugins.lsp.lsp_server_list")

mason_lspconfig.setup({
  ensure_installed = lsp_servers.installServers,
  automatic_installation = true,
})

return {}
